Skip to content

implement stricter regex checks#36

Open
mzuenni wants to merge 7 commits intoDOMjudge:mainfrom
mzuenni:new-regex
Open

implement stricter regex checks#36
mzuenni wants to merge 7 commits intoDOMjudge:mainfrom
mzuenni:new-regex

Conversation

@mzuenni
Copy link
Copy Markdown

@mzuenni mzuenni commented Mar 24, 2026

closes #32

@mzuenni
Copy link
Copy Markdown
Author

mzuenni commented Mar 24, 2026

It is a bit weird to let . actually match \n, but this was documented behaviour so i would keep it.

Copy link
Copy Markdown
Member

@eldering eldering left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't fully review the parser, but in general looks ok. Maybe good to have some tests to see that it accepts and rejects a reasonable set of (in)valid regex strings.

@mzuenni
Copy link
Copy Markdown
Author

mzuenni commented Mar 25, 2026

Also added a bunch of tests now. IMO this is ready to be merged.

@eldering
Copy link
Copy Markdown
Member

eldering commented Mar 30, 2026

I've pushed 2 commits on your branch. One with a testcase that breaks on your code, but worked before. I guess there's more incompatibility between regex implementations, also in specifying character classes.
See also https://www.regular-expressions.info/charclass.html

@mzuenni
Copy link
Copy Markdown
Author

mzuenni commented Mar 30, 2026

thx for the typo fixes :D

One with a testcase that breaks on your code

Yes, currently the mini spec I wrote intentionally excluded the special case of "if [ or ] is at the first position of the charset they are fine without escape". And tests test_regex2_data.err15 and test_regex2_data.err16 checked for that.

Do you think this is an important case that should be included? Personally I would say this is one of the cases where its good to be more restrictive...

@mzuenni
Copy link
Copy Markdown
Author

mzuenni commented Apr 6, 2026

I updated the tests (again disallowing [[] and []]) and added documentation about the supported regex syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REGEX Dialect

2 participants